Skip to content

Read py-catalog-impl from the catalog configuration - #4301

Open
chenjian2664 wants to merge 1 commit into
apache:mainfrom
chenjian2664:chenjian2664/bytequay/read-py-catalog-impl-from-catalog-config
Open

chenjian2664 wants to merge 1 commit into
apache:mainfrom
chenjian2664:chenjian2664/bytequay/read-py-catalog-impl-from-catalog-config

Conversation

@chenjian2664

Copy link
Copy Markdown
Contributor

Rationale for this change

load_catalog only read py-catalog-impl from its keyword arguments. A custom catalog configured in .pyiceberg.yaml, as the configuration docs show, or through PYICEBERG_CATALOG__<NAME>__PY_CATALOG_IMPL was ignored, so loading failed with "URI missing" or picked another catalog type. When the implementation was passed as an argument, the custom catalog also lost the properties from the configuration file.

py-catalog-impl is now read from the merged configuration, and that configuration is passed to the custom catalog.

Are these changes tested?

Are there any user-facing changes?

Yes. A py-catalog-impl set in the configuration file or environment variables now takes effect.

load_catalog only looked for py-catalog-impl in its keyword arguments, so
the documented .pyiceberg.yaml and PYICEBERG_CATALOG__* settings were
ignored and loading failed with "URI missing". When the implementation was
passed as an argument, the custom catalog also lost the properties from the
configuration. Read it from the merged configuration and pass that
configuration to the custom catalog.

test_missing_uri patched the configuration with a MagicMock rather than a
Config, so it now patches an empty Config again.
@chenjian2664
chenjian2664 marked this pull request as ready for review November 14, 2026 11:22
Copilot AI balanced review requested due to automatic review settings November 14, 2026 11:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change to load custom catalogs from merged configuration.

No open issues 🎉

What changed in this PR

This PR makes custom catalog loading honor PyIceberg’s merged configuration, so py-catalog-impl set in configuration files or environment variables takes effect.

Changes:

  • Reads the custom implementation from merged configuration and passes those properties to the catalog.
  • Adds regression coverage for configuration-based loading and corrects the CLI missing-URI test.
File Description
tests/​cli/​test_console.py Corrects the configuration mock and checks the missing-URI error.
tests/​catalog/​test_base.py Verifies custom catalog selection and property forwarding from configuration.
pyiceberg/​catalog/​__init__.py Uses merged configuration to select and initialize custom catalogs.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants